package com.gitee.wsl.mathematics.vector

import com.gitee.wsl.mathematics.vector.ext.reduce
import com.gitee.wsl.mathematics.vector.vec2.Vec2
import com.gitee.wsl.mathematics.vector.vec2.Vec2f
import com.gitee.wsl.mathematics.vector.vec3.Vec3
import com.gitee.wsl.mathematics.vector.vec3.Vec3f
import com.gitee.wsl.mathematics.vector.vec4.Vec4
import com.gitee.wsl.mathematics.vector.vec4.Vec4f
import kotlin.test.Test
import kotlin.test.assertEquals

class ReduceTest {
    @Test
    fun vec2_reduce_success() = assertEquals(3f, Vec2f(1f, 2f).reduce { x, y -> x + y })

    @Test
    fun vec3_reduce_success() = assertEquals(6f, Vec3f(1f, 2f, 3f).reduce { x, y, z -> x + y + z })

    @Test
    fun vec4_reduce_success() = assertEquals(10f, Vec4f(1f, 2f, 3f, 4f).reduce { x, y, z, w -> x + y + z + w })
}